package com.huilian.iotbox.data.service.impl;

import com.huilian.iotbox.data.dao.OrderRefundCommonDao;
import com.huilian.iotbox.data.dto.OrderRefundDto;
import com.huilian.iotbox.data.service.OrderRefundCommonService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class OrderRefundCommonServiceImpl implements OrderRefundCommonService {
    @Resource
    private OrderRefundCommonDao orderRefundCommonDao;
    @Override
    public Integer updateOrderRefund(OrderRefundDto orderRefundDto) {
        Integer result = orderRefundCommonDao.updateOrderRefund(orderRefundDto);
        return result;
    }

    @Override
    public OrderRefundDto getRefundOrderByOutradeNo(String outTradeNo) {
        OrderRefundDto orderRefundDto = orderRefundCommonDao.getRefundOrderByOutradeNo(outTradeNo);
        return orderRefundDto;
    }

    @Override
    public Integer insert(OrderRefundDto orderRefundDto) {
        Integer result = orderRefundCommonDao.insert(orderRefundDto);
        return result;
    }

    /**
     * 根据订单号查询退款记录数
     */
    @Override
    public Integer findOrderRefundCountByOutTradeNo(String outTradeNo) {
        Integer count = orderRefundCommonDao.findOrderRefundCountByOutTradeNo(outTradeNo);
        return count;
    }
}
